package com.example.demo01.listener;

import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@RabbitListener(queues = "sms")
@Component
@Slf4j
public class SmsListener {
//    @Autowired
//    private RabbitTemplate rabbitTemplate;

    //监听到消息了，要做什么？
    @RabbitHandler
    public void execute(String str){
        log.info("消费到消息：{}",str);
    }

}
